package usr

import "github.com/gin-gonic/gin"

var db = make(map[string]string)

func Login(c *gin.Context) {
	var form LoginUser
	c.Bind(&form)
	password := db[form.Account]
	if password == form.Password {
		c.JSON(200, "login success")
	} else {
		c.JSON(401, "login error")
	}
}

type LoginUser struct {
	Account  string `form:"account"`
	Password string `form:"password"`
}
